using System.ComponentModel.DataAnnotations;

namespace FServer.Core.Entities;

/// <summary>
/// 热更新文件信息
/// </summary>
public class UpdateFile
{
    public Guid Id { get; set; }
    
    /// <summary>
    /// 关联的版本ID
    /// </summary>
    public Guid VersionId { get; set; }
    
    /// <summary>
    /// 文件路径
    /// </summary>
    [Required]
    [MaxLength(500)]
    public string FilePath { get; set; } = string.Empty;
    
    /// <summary>
    /// 文件名
    /// </summary>
    [Required]
    [MaxLength(255)]
    public string FileName { get; set; } = string.Empty;
    
    /// <summary>
    /// 文件大小 (字节)
    /// </summary>
    public long FileSize { get; set; }
    
    /// <summary>
    /// 文件MD5校验
    /// </summary>
    [Required]
    [MaxLength(32)]
    public string FileMd5 { get; set; } = string.Empty;
    
    /// <summary>
    /// 文件SHA256校验
    /// </summary>
    [MaxLength(64)]
    public string? FileSha256 { get; set; }
    
    /// <summary>
    /// 下载地址
    /// </summary>
    [Required]
    [MaxLength(500)]
    public string DownloadUrl { get; set; } = string.Empty;
    
    /// <summary>
    /// 文件类型 (Asset, Script, Data, Config)
    /// </summary>
    [Required]
    [MaxLength(20)]
    public string FileType { get; set; } = "Asset";
    
    /// <summary>
    /// 是否压缩
    /// </summary>
    public bool IsCompressed { get; set; } = false;
    
    /// <summary>
    /// 压缩后大小
    /// </summary>
    public long CompressedSize { get; set; }
    
    /// <summary>
    /// 文件版本
    /// </summary>
    [MaxLength(20)]
    public string? FileVersion { get; set; }
    
    /// <summary>
    /// 是否必需
    /// </summary>
    public bool IsRequired { get; set; } = true;
    
    /// <summary>
    /// 文件描述
    /// </summary>
    public string? Description { get; set; }
    
    /// <summary>
    /// 创建时间
    /// </summary>
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    
    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}
